<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="head.jsp" %>

<body class="frame">
<script type="text/javascript" src="scripts/swfupload/swfupload.js"></script>
<script type="text/javascript" src="scripts/swfupload/handlers2.js"></script>
<script type="text/javascript">
    var count0 = 0; // 已上传房源照片
    var count1 = 0; // 已上传楼盘照片
    var swfu0;
    var swfu1;
    window.onload = function () {
        swfu0 = new SWFUpload({
            // Backend settings
            upload_url: "../../saleinfo/DoUploadPicture2?userId=3941",
            //file_post_name: "resume_file",

            // Flash file settings
            file_size_limit: "1 MB",
            file_types: "*.jpg;*.jpeg;*.png;*.gif",
            file_types_description: "图片文件",
            file_upload_limit: "0",
            file_queue_limit: "0",

            // Event handler settings
            // swfupload_loaded_handler: swfUploadLoaded,

            // file_dialog_start_handler: fileDialogStart,
            //file_queued_handler: fileQueued,
            file_queue_error_handler: fileQueueError,
            file_dialog_complete_handler: fileDialogComplete,

            //upload_start_handler : uploadStart,	// I could do some client/JavaScript validation here, but I don't need to.
            //upload_progress_handler: uploadProgress,
            upload_error_handler: uploadError,
            upload_success_handler: uploadSuccess,
            upload_complete_handler: uploadComplete,

            // Button Settings
            // button_image_url: "/images/logo.png",
            button_placeholder_id: "spanButtonPlaceholder0",
            button_width: 93,
            button_height: 27,
            // Flash Settings
            flash_url: "scripts/swfupload/swfupload.swf",

            custom_settings: {
                progress_target: "fsUploadProgress",
                state: 0
            },
            button_window_mode: 'transparent',
            // Debug settings
            debug: false
        });

        swfu1 = new SWFUpload({
            // Backend settings
            upload_url: "../../saleinfo/DoUploadPicture2?State=1&userId=3941",
            //file_post_name: "resume_file",

            // Flash file settings
            file_size_limit: "1 MB",
            file_types: "*.jpg;*.jpeg;*.png;*.gif",
            file_types_description: "图片文件",
            file_upload_limit: "0",
            file_queue_limit: "0",

            // Event handler settings
            // swfupload_loaded_handler: swfUploadLoaded,

            // file_dialog_start_handler: fileDialogStart,
            //file_queued_handler: fileQueued,
            file_queue_error_handler: fileQueueError,
            file_dialog_complete_handler: fileDialogComplete,

            //upload_start_handler : uploadStart,	// I could do some client/JavaScript validation here, but I don't need to.
            //upload_progress_handler: uploadProgress,
            upload_error_handler: uploadError,
            upload_success_handler: uploadSuccess,
            upload_complete_handler: uploadComplete,

            // Button Settings
            // button_image_url: "/images/logo.png",
            button_placeholder_id: "spanButtonPlaceholder1",
            button_width: 93,
            button_height: 27,
            // Flash Settings
            flash_url: "scripts/swfupload/swfupload.swf",

            custom_settings: {
                progress_target: "fsUploadProgress",
                state: 1
            },
            button_window_mode: 'transparent',
            // Debug settings
            debug: false
        });
    };
</script>
<style>

    .swfupload
    {
        cursor : pointer;
    }
</style>

<form id="editForm" name="editForm" method="post" action="<%=path%>/admin/publish-house.do">
<div class="rightBorderContent">

<dl>
    <dt>交易类型：</dt>
    <dd>
        <p>
            <select id="SaleInfoType" name="status">
                <option value="1" selected>住房出租</option>
                <option value="0" >住房出售</option>

            </select>

        </p>
    </dd>
</dl>
<dl>
    <dt>楼盘信息：</dt>
    <dd>
        <p>
            <input id="projectTitle" name="address" type="text" value="" class="greyBorderInput required" defaultText="填写楼盘地址信息" maxlength="20" />
            <span targetId="projectTitle" class="tipMsg">必填</span>
            <span id="guessProject" class="hidden tipMsg"> 您是不是要输入 <span id="projectCondidates"></span></span>
        </p>
    </dd>
</dl>
<dl>
    <dt>楼层：</dt>
    <dd>
        <p>
            第
            <input id="FloorNum" name="floor" type="text" value="" class="greyBorderInput w30 required number" />
            层/共
            <input id="TotalFloorNum" name="totalfloor" type="text" value="" class="greyBorderInput w30 required number" />
            层
            <span targetId="FloorNum" class="tipMsg">楼层数必须填写</span>
            <span targetId="TotalFloorNum" class="tipMsg">总楼层数必须填写</span>

        </p>
    </dd>
</dl>
<dl>
    <dt>户型：</dt>
    <dd>
        <p class="structureWarning">
            <input id="RoomCount" name=roomNum type="text" value="" class="greyBorderInput w30 required number" min="0" />
            房
            <input id="ParlourCount" name="parlorNum" type="text" value="" class="greyBorderInput w30 required number" min="0" />
            厅
            <input id="ToiletCount" name="bathroomNum" type="text" value="" class="greyBorderInput w30 required number" min="0" />
            卫

            <span targetId="RoomCount" class="tipMsg">房间数不正确</span>
            <span targetId="ParlourCount" class="tipMsg">厅数不正确</span>
            <span targetId="ToiletCount" class="tipMsg">卫生间数不正确</span>


        </p>
    </dd>
</dl>
<dl>
    <dt>产权面积：</dt>
    <dd>
        <p class="areaWarning">
            <input id="HouseArea" name="area" type="text" value="" class="greyBorderInput w55 required number" min="0" /> 平米
            <span targetId="HouseArea" class="tipMsg">请填写正确的产权面积</span>


        </p>
    </dd>
</dl>
<dl>
    <dt>价格：</dt>
    <dd>
        <p>
            <input id="Price" name="price" type="text" value="" class="greyBorderInput w55 required number" min="0" />
            <span id="priceText">万元</span>

            <span targetId="Price" class="tipMsg">请填写正确的价格</span>
        </p>
    </dd>
</dl>
<dl>
    <dt>建成年份：</dt>
    <dd>
        <p>
            <input id="YearOfBuilding" name="year" type="text" value="" class="greyBorderInput w55 required number" min="1949" max="2013" /> 年
            <span targetId="YearOfBuilding" class="tipMsg">请填写正确的年份</span>
        </p>
    </dd>
</dl>
<dl>
    <dt>装修状况：</dt>
    <dd>
        <p>
            <input id="FitmentType0" name="decration" value="0" checked=&#39;checked&#39; type="radio" />
            <label for="FitmentType0" class="prl">毛坯</label>
            <input id="FitmentType1" name="decration" value="1"  type="radio" />
            <label for="FitmentType1" class="prl">普装</label>
            <input id="FitmentType2" name="decration" value="2"  type="radio" />
            <label for="FitmentType2" class="prl">中装</label>
            <input id="FitmentType3" name="decration" value="3"  type="radio" />
            <label for="FitmentType3" class="prl">高装</label>

        </p>
    </dd>
</dl>
<dl>
    <dt>房源标题：</dt>
    <dd>
        <p>
            <input id="Title" name="hname" type="text" value="" class="greyBorderInput w300 required" maxlength="22" defaultText="“标题”决定客源来电！不超过22个字"/>

            <span targetId="Title" class="tipMsg">必填，不超过22个字</span>
        </p>
    </dd>
</dl>
<dl>
    <dt class="noStar">房源说明：</dt>
    <dd>
        <p>
            <textarea id="Description" name="content" class="greyBorderInput w600" rows="5" defaultText="“说明”决定客源来电！超过50个字即可获得“详述”标签"></textarea>
            <span targetId="Description" class="tipMsg">不超过500个字</span>
        </p>

    </dd>
</dl>


<dl>
    <dt class="noStar">&nbsp;</dt>
    <dd>
        <p>
            <input type="submit" value="发布" class="greenBtn left" />

            

        </p>
    </dd>

</dl>
</div>
<input id="Latitude" name="Latitude" type="hidden" value="" />
<input id="Longitude" name="Longitude" type="hidden" value=""/>

</form>
<!-- datas -->
<div saleInfoType="0" saleInfoTypeName="出售" priceText="万元" expiredDay="30" warningType="0" class="saleInfoData hide"></div>
<div saleInfoType="1" saleInfoTypeName="出租" priceText="元/月" expiredDay="10" warningType="1" class="saleInfoData hide"></div>
<div saleInfoType="2" saleInfoTypeName="交换" priceText="万元" expiredDay="30" warningType="0" class="saleInfoData hide"></div>
<div saleInfoType="3" saleInfoTypeName="抵押" priceText="万元" expiredDay="30" warningType="0" class="saleInfoData hide"></div>

<script type="text/javascript">

    var structureWarning0 = "请录入产证上的户型，否则每个用户被网管纠正累计超过3次者，刷新功能将被暂停，在支付10元弥补费给网站后房源刷新功能才会恢复。";
    var structureWarning1 = "请录入实际分摊使用到的户型，否则每个用户被网管纠正累计超过3次者，刷新功能将被暂停，在支付10元弥补费给网站后房源刷新功能才会恢复。";
    var areaWarning0 = "请录入产证上的面积，否则每个用户被网管纠正累计超过3次者，刷新功能将被暂停，在支付10元弥补费给网站后房源刷新功能才会恢复。";
    var areaWarning1 = "请录入实际分摊使用到的面积，否则每个用户被网管纠正累计超过3次者，刷新功能将被暂停，在支付10元弥补费给网站后房源刷新功能才会恢复。";

    $(function () {

        //        $("input[name=SaleInfoType]").change(function () {
        //            bindPulishInfo(this.value);
        //        });
        //        $("input[name=SaleInfoType]").each(function () {
        //            if (this.checked) {
        //                bindPulishInfo(this.value);
        //            }
        //        });
        $("#SaleInfoType").change(function () {
            bindPulishInfo(this.value);
        });
        bindPulishInfo($("#SaleInfoType").val());
        bindImageDelBtn();
        bindPictureContainer();
        // 房源发布页面的编辑地图功能
        $(".markMap").click(function () {
            if (!$(this).attr("done")) {
                $(this).attr("done", "true");
                $(this).parent().hide();
                $("#setMapHopup").show();
                SetMap();
                fixFrame(parent.document.getElementById('frame'));
            }
        });
        if ($("#Latitude").val() && $("#Latitude").val() != '0' && $("#Longitude").val() && $("#Longitude").val() != '0') {

            $(".markMap").attr("done", "true").parent().hide();
            $("#setMapHopup").show();
            SetMap();
            fixFrame(parent.document.getElementById('frame'));
        }
    });

    function bindPulishInfo(saleInfoType) {
        var dataDiv = $(".saleInfoData[saleInfoType=" + saleInfoType + "]");
        $("#priceText").text(dataDiv.attr("priceText"));
        $("#saleInfoTypeName").text(dataDiv.attr("saleInfoTypeName"));
        $("#expiredDay").text(dataDiv.attr("expiredDay"));

        if (dataDiv.attr("warningType") == "0") {
            $(".structureWarning").attr("title", structureWarning0);
            $(".areaWarning").attr("title", areaWarning0);
        }
        else if (dataDiv.attr("warningType") == "1") {
            $(".structureWarning").attr("title", structureWarning1);
            $(".areaWarning").attr("title", areaWarning1);
        }
    }
</script>
</body>
</html>
